* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #1f77b4;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.image-section, .chat-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.image-section h2, .chat-section h2 {
    color: #ff7f0e;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.image-preview {
    width: 100%;
    height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-preview span {
    color: #999;
}
/* 图像预览区域样式 */
.upload-area {
    text-align: center; /* 让整个上传区域内容居中 */
}

.upload-box {
    display: flex;
    flex-direction: column;
    align-items: center; /* 让上传框内的所有元素居中 */
}

.image-previews {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    gap: 15px; /* 图像之间的间距 */
    width: 100%;
    min-height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
}

.image-previews > span {
    color: #999;
    font-style: italic;
}

/* 单个图像容器样式 */
.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    text-align: center;
}

.image-container img {
    max-width: 180px;
    max-height: 180px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 删除按钮样式 */
.delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #ff7875;
    transform: scale(1.1);
}


/* 图像标签样式 */
.image-label {
    font-size: 14px;
    margin-top: 5px;
    color: #666;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button {
    background-color: #1f77b4;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #1668a0;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.result-area {
    margin-bottom: 20px;
}

.result-area h3 {
    margin-bottom: 10px;
    color: #555;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.chat-history {
    height: 400px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.chat-message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 80%;
}

.chat-message.user {
    background-color: #e6f7ff;
    border-left: 5px solid #1890ff;
    margin-left: auto;
}

.chat-message.assistant {
    background-color: #f6ffed;
    border-left: 5px solid #52c41a;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: bold;
}

.message-time {
    font-size: 0.8rem;
    color: #888;
}

.chat-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#message-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #1f77b4;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .upload-area {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* 思考指示器样式 */
#ai-thinking {
    opacity: 0.7;
    margin-top: 10px; /* 添加一些上边距，与上面的对话分开 */
}

.thinking-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #52c41a;
    animation: thinking 1.4s ease-in-out infinite both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 确保对话历史区域有固定高度和滚动条 */
.chat-history {
    height: 500px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* 禁用状态 */
.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* 处理中消息样式 */
.chat-message.system {
    background-color: #f9f0ff;
    border-left: 5px solid #722ed1;
}

.thinking-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #722ed1;
    animation: thinking 1.4s ease-in-out infinite both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}